//
//  YLAmemberView.swift
//  Your Lover AI
//
//  Created by 阿忠 on 2024/6/27.
//

import Foundation
import UIKit

/**
 会员权益的视图
 */
class YLAmemberView: UIView {
    //背景
    lazy var backVc: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor(hex: "#F5BA5D")
        view.layer.cornerRadius = 15.0 // 设置圆角半径为10.0
        view.layer.masksToBounds = true
        return view
    }()
    var wirtVc: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor(hex: "FFD696")
        view.layer.cornerRadius = 9.0 // 设置圆角半径为10.0
//        view.alpha = 0.16
        view.layer.masksToBounds = true
        return view
    }()
    
    let titleLabel = UILabel()
    lazy var icon1Img: UIImageView = {
        let image = UIImageView(image: UIImage(named: "vip_gou"))
        return image
    }()
    lazy var icon2Img: UIImageView = {
        let image = UIImageView(image: UIImage(named: "vip_gou"))
        return image
    }()
    lazy var icon3Img: UIImageView = {
        let image = UIImageView(image: UIImage(named: "vip_gou"))
        return image
    }()
    lazy var icon4Img: UIImageView = {
        let image = UIImageView(image: UIImage(named: "vip_gou"))
        return image
    }()
    
    lazy var icon5Img: UIImageView = {
        let image = UIImageView(image: UIImage(named: "vip_gou"))
        return image
    }()
    let content1Label = UILabel()
    let content2Label = UILabel()
    let content3Label = UILabel()
    let content4Label = UILabel()
    let content5Label = UILabel()
 
    
    init(frame: CGRect, time: String, content: String, price: String) {
        super.init(frame: frame)
        
        setupUI(time: time, content: content, price: price)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI(time: String, content: String, price: String) {
        // 设置自定义弹窗的样式和布局
        
        self.addSubview(backVc)
        backVc.snp.makeConstraints { make in
            make.left.top.right.bottom.equalToSuperview()
        }
        
        // 时间
        titleLabel.textColor = UIColor(hex: "8A4C06")
        titleLabel.text = "Lifetime Rights Description"
        titleLabel.font = UIFont.systemFont(ofSize: 14)
        titleLabel.textAlignment = .center
        self.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.top.equalTo(11)
            make.centerX.equalToSuperview()
        }
        
        self.addSubview(wirtVc)
        wirtVc.snp.makeConstraints { make in
            make.left.equalTo(9)
            make.right.equalTo(-9)
            make.bottom.equalTo(-9)
            make.top.equalTo(titleLabel.snp.bottom).offset(9)
        }
        
        wirtVc.addSubview(icon1Img)
        icon1Img.snp.makeConstraints { make in
            make.top.equalTo(14)
            make.left.equalTo(33)
            make.width.height.equalTo(14)
        }
        
        wirtVc.addSubview(content1Label)
        content1Label.textColor = UIColor(hex: "8A4C06")
        content1Label.text = "Lifetime Rights Description"
        content1Label.font = UIFont.systemFont(ofSize: 13)
        content1Label.textAlignment = .left
        content1Label.snp.makeConstraints { make in
            make.left.equalTo(icon1Img.snp.right).offset(6)
            make.centerY.equalTo(icon1Img)
        }
        
        wirtVc.addSubview(icon2Img)
        icon2Img.snp.makeConstraints { make in
            make.top.equalTo(icon1Img.snp.bottom).offset(15)
            make.left.equalTo(33)
            make.width.height.equalTo(14)
        }
        
        wirtVc.addSubview(content2Label)
        content2Label.textColor = UIColor(hex: "8A4C06")
        content2Label.text = "Lifetime Rights Description"
        content2Label.font = UIFont.systemFont(ofSize: 13)
        content2Label.textAlignment = .left
        content2Label.snp.makeConstraints { make in
            make.left.equalTo(icon2Img.snp.right).offset(6)
            make.centerY.equalTo(icon2Img)
        }
        
        wirtVc.addSubview(icon3Img)
        icon3Img.snp.makeConstraints { make in
            make.top.equalTo(icon2Img.snp.bottom).offset(15)
            make.left.equalTo(33)
            make.width.height.equalTo(14)
        }
        
        wirtVc.addSubview(content3Label)
        content3Label.textColor = UIColor(hex: "8A4C06")
        content3Label.text = "Lifetime Rights Description"
        content3Label.font = UIFont.systemFont(ofSize: 13)
        content3Label.textAlignment = .left
        content3Label.snp.makeConstraints { make in
            make.left.equalTo(icon3Img.snp.right).offset(6)
            make.centerY.equalTo(icon3Img)
        }
        
        wirtVc.addSubview(icon4Img)
        icon4Img.snp.makeConstraints { make in
            make.top.equalTo(icon3Img.snp.bottom).offset(15)
            make.left.equalTo(33)
            make.width.height.equalTo(14)
        }
        
        wirtVc.addSubview(content4Label)
        content4Label.textColor = UIColor(hex: "8A4C06")
        content4Label.text = "Lifetime Rights Description"
        content4Label.font = UIFont.systemFont(ofSize: 13)
        content4Label.textAlignment = .left
        content4Label.snp.makeConstraints { make in
            make.left.equalTo(icon4Img.snp.right).offset(6)
            make.centerY.equalTo(icon4Img)
        }
        
   
        wirtVc.addSubview(icon5Img)
        icon5Img.snp.makeConstraints { make in
            make.top.equalTo(icon4Img.snp.bottom).offset(15)
            make.left.equalTo(33)
            make.width.height.equalTo(14)
        }
        
        wirtVc.addSubview(content5Label)
        content5Label.textColor = UIColor(hex: "8A4C06")
        content5Label.text = "Lifetime Rights Description"
        content5Label.font = UIFont.systemFont(ofSize: 13)
        content5Label.textAlignment = .left
        content5Label.snp.makeConstraints { make in
            make.left.equalTo(icon5Img.snp.right).offset(6)
            make.centerY.equalTo(icon5Img)
        }
        
    }
    

}
